use super::types::{Color, ColorTuple, Kilometer, Electron};
/// 初始化struct
pub fn test() {
    let black = Color { red: 0, green: 0, blue: 0 };

    println!("Black = rgb({}, {}, {})", black.red, black.green, black.blue);
    
    let mut link_color = Color { red: 0, green: 0, blue: 255 };
    link_color.blue = 238;
    println!("Link Color = rgb({}, {}, {})", link_color.red, link_color.green, link_color.blue);

    let blue = Color { blue: 255, ..link_color };
    println!("Blue = rgb({}, {}, {})", blue.red, blue.green, blue.blue);

    let Color { red: r, green: g, blue: b } = blue;
    println!("Blue = rgb({}, {}, {})", r, g, b);

    let midnightblue = || -> Color { Color { red: 25, green: 25, blue: 112 } }();
    println!("Midnight Blue = rgb({}, {}, {})", midnightblue.red, midnightblue.green, midnightblue.blue);

    let black = ColorTuple(0, 0, 0);
    let ColorTuple(r, g, b) = black;
    println!("Black = rgb({}, {}, {})", r, g, b);

    let distance = Kilometer(20);
    let Kilometer(distance_in_km) = distance;
    println!("The distance: {} km", distance_in_km);

    let x = Electron;
    println!("The Electron is {:?}", x);
}
